home *** CD-ROM | disk | FTP | other *** search
- ******************************
- MIDI2TXT v1.4
-
- midi binaries to text mnemonic
- by Guenter Nagler
- 1995
- (gnagler@ihm.tu-graz.ac.at)
- ******************************
-
- [1] BACKGROUND
- My first intention writing this program was getting knowledge about
- midi. After writing the pendant TXT2MIDI program I used it to sequence
- some music titles. When I bought my music workstation (including a more
- powerful sequencer) my use of MIDI2TXT/TXT2MIDI changed into an
- updating environment to make less compatible midi files full compatible.
- Another use possibility came up when I copied some excellent midi
- binaries from news://alt.binaries.sounds.midi . I converted one with
- MIDI2TXT into text, commented all commands that played notes in leading
- track and converted it back into another midi file (TXT2MIDI). The new
- midi file played the full background of the music while I was able to
- learn playing the lead voice for my own pleasure.
-
- [2] FILES DESCRIPTION
-
- MIDI2TXT.EXE.........converter program
- MIDI2TXT.DOC.........this file, showing usage of MIDI2TXT.EXE
- MIDIIO.HPP...........header file for a c++ midi parser
- MIDIIO.CPP...........source code for a c++ midi parser
- MIDI2TXT.CPP.........c++ source code for midi to text
- MIDI2TXT.MAK.........make file for project
- MIDI2TXT.CFG.........compiler options for make
- MIDI2TXT.PRJ.........project for borland c++ compilers
- only MIDI2TXT.EXE is required to run program
-
- [3] COPYRIGHT
-
- MIDI2TXT (c) 1995 was created by Guenter Nagler.
-
- MIDI2TXT is free and may be used as you wish with this one exception:
-
- You may NOT charge any fee or derive any profit for distribution
- of MIDI2TXT. Thus, you may NOT sell or bundle MIDI2TXT with any
- product in a retail environment (shareware disk distribution, CD-ROM,
- etc.) without permission of the author.
-
- You may give MIDI2TXT to your friends, upload it to a BBS, or ftp it to
- another internet site, as long as you don't charge anything for it.
-
- [4] DISCLAIMER
-
- MIDI2TXT was designed to handle 100% compatible midi files.
- It was tested with 600 different midi files but I can not say if
- each 100% midi compatible midi file can be correctly converted.
- So I give no guarantees of the results, especially with non 100%
- compatible midi files.
- If you find a midi file that you think to be 100% compatible midi
- that is not correctly converted, please send a sample file to
- gnagler@ihm.tu-graz.ac.at .
-
- Use MIDI2TXT at your own risk. Anything you do with MIDI2TXT is your
- responsibility, and not the author's. Any damage caused to any person,
- computer, software, hardware, company, or business by running MIDI2TXT
- is your responsibility, and the author will not be liable.
-
- If you don't understand these terms, or are not sure of something, or
- are afraid something bad might come of using MIDI2TXT, don't use it!
- You are here forewarned.
-
- [5] INSTALLATION
-
- [MSDOS]
-
- Simply copy MIDI2TXT.EXE in a directory that is in your path.
- When you start the program without arguments
-
- C:\> MIDI2TXT
-
- you should get the usage text (see next section)
-
- [UNIX]
- compile sources with your C++ compiler (e.g. GNU Compiler g++):
-
- g++ -o midi2txt midi2txt.cpp midiio.cpp
-
- and run program
-
- $ midi2txt
-
- [6] USAGE
-
- usage: MIDI2TXT [-error][-chunk][-short][-info][-lyric][-tact] file.mid [> file.txt]
-
- The parts in brackets [...] are optional.
-
- The text output is normally written to screen but can be relinked
- to a file (> filename.txt) or a printer (> prn). See your MS-DOS
- manual for usage of > and >> operators.
-
- The program MIDI2TXT allows some options:
- -error checks midifile for errors
- -chunk shows only the header and midi tracks (without contents, but
- channel number if available)
-
- -short shows only program changes and text information
-
- -info shows only program changes, bank changes, volume and text
- information (no notes and time delays)
-
- -lyric shows only text and lyric meta events and interprets special
- character sequences in text (as used in some karaoke players):
- / or \ as end of line, end of paragraph
- @K kind of midi file (usually karaoke)
- @V version
- @I information
- @L language
- @T title of file
-
- If none of the options -chunk, -short, -info, -lyric is specified all
- midi commands are printed.
-
- -tact marks all tact changes with a point and comments.
- This option is ignored if the song changes tact while playing.
-
- Warning:
- Do not expect that MIDI2TXT + TXT2MIDI will produce a copy of the original
- file! MIDI allows to encode its commands in different ways without
- changing the semantic of the notes (It is allowed to compress the
- midi file by ommiting redunant command bytes, but it is no duty).
-
- [7] A sample of resulting text output
-
- // is a comment that ends at end of line (all characters are ignored)
- /* is a comment that ignores all characters, lines until */
- // the comments at right side are not produced by the program
-
- // sample.mid
- mthd // start of header
- // 1 song // midi2txt converts only the first song!
- // 3 tracks
- unit 192 // is 1/4 // time units that build a quarter pause
- end mthd // end of header
-
- mtrk // start of a track without channel
- copyright "(c) Guenter Nagler" // any copyright text
- trackname "Ballade pour Adeline" // any track name
- tact 4 / 4 24 8 // song in 4/4 tact, 24 clicks per beat, 8/32 is 1/4 note
- beats 68 // tempo in ticks/min or beats/min
- end mtrk // end of track
-
- mtrk($D) // a track with channel D hex (=13 dec)
- trackname "Melody"
- program BritePiano // program name
- balance left // a panpot control parameter
- +c4 $40; // + are pressing keys, velocity as param
- 48;+g4 $40; // 48 is 1/16 duration (pause to next command)
- 48;-g4 $7F; // - are releasing keys, velocity as param
- +c5 $40; // note commands are separated by ;
- 1/16;-c5 $7F; // exact aligned duration can be written as 1/16
- +d5 $40;
- 1/16;-d5 $7F;
- -c4 $7F;
- +c4 $40;
- 1/16;+g4 $40;
- 1/16;-g4 $7F;
- +c5 $40;
- 1/16;-c5 $7F;
- +d5 $40;
- 1/16;-d5 $7F;
- -c4 $7F;
- +c4 $40;
- 1/16;+g4 $40;
- 1/16;-g4 $7F;
- +c5 $40;
- 1/16;-c5 $7F;
- +d5 $40;
- 1/16;-d5 $7F;
- -c4 $7F;
- +c4 $40;
- 1/16;+g4 $40;
- 1/16;-g4 $7F;
- +c5 $40;
- 1/16;-c5 $7F;
- +d5 $40;
- 1/16. // tact 1 // end of tact 1 (using option -tact)
- end mtrk
-
- A further description of the text language can be found in documentation
- of TXT2MIDI.
-
- [8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
-
- WWW: http://hgiicm.tu-graz.ac.at/Cpub
- contains all my dos/unix midi programs
- EMAIL: gnagler@ihm.tu-graz.ac.at
-
- [9] CHANGES
- v1.0 to v1.1:
- * added version field in midi header
- * tempo is now printed by beats command as floatingpoint numbers
- * new option -error checks if midifile is correct otherwise
- prints an error message
- * some portability changes for UNIX compatibility
- v1.1 to v1.2:
- * added detailed sysex information for common sysex commands
- (GMReset, GSReset, GSExit)
- * minor bugs in output information level
-
- v1.2 to v1.3:
- * added meta events mnemonics prefixchannel and prefixport
-
- v1.3 to v1.4:
- * bug fixed that caused unexpected end-of-file-error for certain valid midi files
- * added -version option
- * note B is now written as B (former H, as used in German language)
- v1.4 to v1.5:
- * added RPN control commands highrpn, lowrpn
- * fixed bug that generated negative number of quarternotes for very high
- pause values
- * added XGreset command